﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using 刘颜红销售项目管理.Business.DOM ;
using XDesigner.ORM;
using 刘颜红销售项目管理.Business;

namespace 刘颜红销售项目管理
{
    public partial class dlg项目基本信息 : DevExpress.XtraEditors.XtraForm
    {
        public dlg项目基本信息()
        {
            InitializeComponent();
        }

        private object _DataSource = null;

        public object DataSource
        {
            get { return _DataSource; }
            set { _DataSource = value; }
        }

        private Class项目基本信息 _项目基本信息 = null;

        public Class项目基本信息 项目基本信息
        {
            get { return _项目基本信息; }
            set { _项目基本信息 = value; }
        }

        private void frm单位基本信息_Load(object sender, EventArgs e)
        {
            cbo项目状态.Items.AddRange(Enum.GetValues(typeof(Enum项目状态)));
            MyApplicationFramework.Instance.ORMEngine.OpenConnection();
            cboMachineTypes.Items.Clear();
            Array types = MyApplicationFramework.Instance.ORMEngine.ReadAllInstances(typeof(Class产品型号));
            foreach (Class产品型号 type in types)
            {
                cboMachineTypes.Items.Add(type.型号);
            }

            myUnitList.DataSource = MyApplicationFramework.Instance.ORMEngine.CreateBindingSource(
                typeof(Class工作单位),
                MyApplicationFramework.Instance.ORMEngine.ReadAllInstances(typeof(Class工作单位)));

            Array units = MyApplicationFramework.Instance.ORMEngine.ReadAllInstances(typeof(Class人员基本信息));
            ORMBindingSource ds = MyApplicationFramework.Instance.ORMEngine.CreateBindingSource(typeof(Class人员基本信息), units);
            myPeopleList.DataSource = ds;
             
            if (this._项目基本信息 != null)
            {
                BindingSource bs = new BindingSource();
                bs.Add(this._项目基本信息);
                myDetailGridControl.DataSource = bs;// this.DataSource;
            }

            MyApplicationFramework.Instance.ORMEngine.CloseConnection();
        }
         
        private void cmdOK_Click(object sender, EventArgs e)
        {
            this.Close();
        } 
    }
}